package com.jsgt.greekfire.ui.home.entrance.walletList.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.fhx.core.base.BaseAdapter
import com.fhx.core.base.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.dao.model.IdentityBean

/**
 * author fhx
 * create time 2020/4/23 17:06
 **/
class WalletAdapter : BaseAdapter<IdentityBean>() {

    inner class VH(itemView: View) : BaseViewHolder(itemView) {
        private var name_tv: TextView? = null
        private var pri_key_tv: TextView? = null

        init {
            with(itemView) {
                name_tv = findViewById(R.id.name_tv)
                pri_key_tv = findViewById(R.id.pri_key_tv)
            }
        }

        fun bindData(identity: IdentityBean) {
            name_tv?.text = identity.identityName
//            pri_key_tv?.text = identity.utiAddress
        }
    }

    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        val viewHolder = holder as VH
        viewHolder.bindData(dataList()[position])
    }

    override fun provideViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder? {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.item_wallet, parent, false)
        return VH(view)
    }
}